package geeksforgeeks.trees;

public class DepthTree {
	public static void main(String[] args) {
		Node root = new Node(1);
		
		root.left = new Node(2);
		
		root.left.left = new Node(4);
		root.left.right = new Node(5);
		root.right = new Node(3);
		
		System.out.println(findDepth(root));
	}
	
	public static int findDepth(Node root)
	{
		if(root == null)
			return 0;
		else
		return 1 + Math.max(findDepth(root.left), findDepth(root.right)); 
		
	}
	
	static class Node {
		int data;
		Node left;
		Node right;
		
		public Node(int data)
		{
			this.data = data;
			left = right = null;
		}
	}

}
